namespace :sinatra do
  
  namespace :add do
    
    desc 'Add a namespaced /routes file'
    task :routes, :namespace do |t, args|
      if args.namespace == nil
        puts 'You must define a route namespace.'
        puts 'Example: rake sinatra:add:routes[my_routes]'
        exit
      end
      create_directory './routes', './tests', './tests/routes'
      copy_template "#{TEMPLATES}/sinatra/routes/routes.rb",
                    "./routes/#{args.namespace}.rb",
                    { namespace: args.namespace }
      copy_template "#{TEMPLATES}/sinatra/tests/routes/routes_tests.rb",
                    "./tests/routes/#{args.namespace}_tests.rb",
                    { namespace: args.namespace }
    end
    
  end
  
end
